package edu.pku.sei.transformation.editor.controller.editparts.node;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.editpolicies.DirectEditPolicy;

import edu.pku.notation.runtime.constance.ColorConstance;
import edu.pku.sei.modeler.model.structure.MetaShapeElement;
import edu.pku.sei.transformation.editor.controller.policies.NodeComponentEditPolicy;
import edu.pku.sei.transformation.editor.controller.policies.TransformationNodeEditPolicy;

public class PinEditpart extends AdsorbNodeEditpart {
	public static int WIDTH = 10;
	public static int HEIGHT = 10;
	public PinEditpart(MetaShapeElement model) {
		super(model);
		offsetX = - WIDTH/2;
		offsetY = - HEIGHT/2;
	}

	@Override
	protected DirectEditPolicy createDirectEditPolicy() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected IFigure createFigure() {
		RectangleFigure figure = new RectangleFigure();
		figure.setFill(true);
		figure.setBackgroundColor(ColorConstance.GRAY);
		figure.setForegroundColor(ColorConstance.BLACK);
		figure.setSize(WIDTH, HEIGHT);
		return figure;
	}
	
	protected void createEditPolicies() {
		super.createEditPolicies();
		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
				new TransformationNodeEditPolicy());
		installEditPolicy(EditPolicy.COMPONENT_ROLE,
				new NodeComponentEditPolicy());
	}
	
}
